

from bqtool.tgsdata.kafka_kit import Kafka_consumer
from bqtool.utils.tools import get_mysql
import time

# mysql = get_mysql('tsce','ehl1234','10.2.111.57','tsce',4000)
consumer = Kafka_consumer(['10.150.27.143:9092'],'passcar', groupid='xinxiang')
try:
    data = consumer.read_df()
    count = 0
    print('开始')
    for message in data:
        # count += len(message[message.CARPLATE == '鲁RP5052'])
        count += 1
        print(count)
        time.sleep(1)
        # message.to_sql('t_passcar_xinxiang', mysql, if_exists='append', index=False)
    print(f'计数{count}')
    # print(f'保存成功{len(message)}')
except Exception as e:
    print(e)
print('end')